import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;
import org.ww.bean.Person;
import org.ww.config.MainConfigOfPropertyValue;

public class IOCTestPropertyValue {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfPropertyValue.class);
    @Test
    public void test01(){
        print();
        System.out.println("================================");
        Person bean = applicationContext.getBean(Person.class);
        System.out.println(bean);

        Environment environment = applicationContext.getEnvironment();
        String nickname = environment.getProperty("person.nickname");
        System.out.println("nickname-->"+nickname);
    }

    public void print(){
        String[] names = applicationContext.getBeanDefinitionNames();
        for(String name:names){
            System.out.println(name);
        }
    }
}
